// ---------------------------------------------------------------------
//
// -- 大厅中介层
// -- author £
//
// ---------------------------------------------------------------------

const CommonInfo = require('CommonInfo'),
    AppInfo = require('AppInfo'),
    Platform = require('Platform'),
    GameConfig = require('GameConfig'),
    Alert = require('Alert'),
    CommonUtil = require('CommonUtil'),
    superClass = require('lobby_single_base').LobbySingleMediator;

let cl = cc.Class({
    name: "LobbyMediator",
    extends: superClass,
    properties: {
    },

    initCtor: function () {
        CommonUtil.mysuper(superClass, this, 'initCtor');
        this.model = require('LobbyModel');
    },

    clearData: function () {
        CommonUtil.mysuper(superClass, this, 'clearData');
    },

    onRegister: function (v) {
        CommonUtil.mysuper(superClass, this, 'onRegister', v);
    },

    onShow: function () {
        CommonUtil.mysuper(superClass, this, 'onShow');
        Platform.showBannerAd();
    },

    onHide: function () {
        CommonUtil.mysuper(superClass, this, 'onHide');
        Platform.hideBannerAd();
    },

    onRelease: function () {
        CommonUtil.mysuper(superClass, this, 'onRelease');
    },

    //------------------------------------------------------------------------------

    //------------------------------------------------------------------------------


    //------------------------------------------------------------------------------

    returnHandler: function () {
        if (CommonInfo.sceneState === 1) return;
        
        if (this._rankShow) {
            this.hideRankHandler();
        } else {
            Platform.exitMiniProgram();
        }
    },

});

let LobbyMediator = new cl();

module.exports = LobbyMediator;
